package repositories;

import java.util.Collection;
import java.util.Map;

import domain.Entity;
import domain.Restaurant;

public class InMemRestaurantRepository implements RestaurantRepository<Restaurant, String>{
	private Map<String,Restaurant> entities;

	public Map<String, Restaurant> getEntities() {
		return entities;
	}

	public void setEntities(Map<String, Restaurant> entities) {
		this.entities = entities;
	}

	@Override
	public void add(Restaurant entity) {
		// TODO Auto-generated method stub
		entities.put(entity.getName(), entity);
	}

	@Override
	public void remove(String id) {
		// TODO Auto-generated method stub
		if(entities.containsKey(id))
			entities.remove(id);
	}

	@Override
	public void update(Restaurant entity) {
		// TODO Auto-generated method stub
		if(entities.containsKey(entity.getName()))
			entities.put(entity.getName(), entity);
	}

	@Override
	public boolean contains(String id) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public Entity<String> get(String id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Collection<Restaurant> getAll() {
		// TODO Auto-generated method stub
		return entities.values();
	}

	@Override
	public boolean containsName(String name) {
		// TODO Auto-generated method stub
		return entities.containsKey(name);
	}
	
}
